package org.catdroid.apps;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;

public class tabHost extends TabActivity {


	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);


		final TabHost tabHost = getTabHost();

		//Tab1 -- Todas
		tabHost.addTab(tabHost.newTabSpec("tab1")
				.setIndicator("Todas")
				.setContent(new Intent(this, List.class)
				.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED)));
		//Tab2 -- Ordenadas por fecha
		tabHost.addTab(tabHost.newTabSpec("tab2")
				.setIndicator("Fecha")
				.setContent(new Intent(this, List.class).putExtra(Main.KEY_DATE, true)
				.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED)));
		//Tab3 -- Instaladas
		tabHost.addTab(tabHost.newTabSpec("tab3")
				.setIndicator("Instaladas")
				.setContent(new Intent(this, List.class).putExtra(Main.KEY_INSTALADAS, true)
				.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED)));

		Bundle extras = getIntent().getExtras();
		if(extras != null) {
			if(extras.getBoolean(Main.KEY_DATE, false)) {
				tabHost.setCurrentTab(1);
			}
			else if(extras.getBoolean(Main.KEY_INSTALADAS, false)) {
				tabHost.setCurrentTab(2);
			}
		}
	}

}
